package com.android.vgongyi.activity;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.view.View.OnClickListener;
import android.webkit.CookieManager;
import android.webkit.CookieSyncManager;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.widget.Button;

import com.android.vgongyi.R;

public class HomePageActivity extends Activity{
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.homepage);
		
		WebView webView 	   = (WebView) this.findViewById(R.id.homepage_webview);
		
		Intent intent = getIntent();
		String weiboUrl = intent.getStringExtra("weiboUrl");
		String weibo_url = intent.getStringExtra("weibo_url");
		
		webView.setBackgroundResource(R.drawable.about_bg);
        WebSettings settings = webView.getSettings();
        settings.setDefaultFontSize(14);
        webView.setVerticalScrollBarEnabled(false);
		webView.setHorizontalScrollBarEnabled(false);
		webView.getSettings().setJavaScriptEnabled(true);
		if(TextUtils.isEmpty(weiboUrl)) webView.loadUrl(weibo_url);
		else 							webView.loadUrl(weiboUrl);
		
		Button common_back = (Button) findViewById(R.id.Common_back);
		common_back.setVisibility(View.VISIBLE);
		common_back.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View arg0) {
				
				finish();
			}
		});
	}
	
	@Override
	protected void onStop() {
		CookieSyncManager.createInstance(HomePageActivity.this);   
		CookieManager cookieManager = CookieManager.getInstance();  
		cookieManager.removeAllCookie();  
		super.onStop();
	}

	
}
